#ifndef _UNIQUE_POINTER_H_
#define _UNIQUE_POINTER_H_

#include "Pointer.h"

namespace MySTL
{

template < typename T >
class UniquePointer : public Pointer<T>
{
public:
	UniquePointer(T* ptr = NULL);
	~UniquePointer();

	virtual void reset(T* ptr = NULL);
};

template < typename T >
UniquePointer<T>::UniquePointer(T* ptr) : Pointer<T>(ptr)
{
}

template < typename T >
UniquePointer<T>::~UniquePointer()
{
	reset();
}

template < typename T >
void UniquePointer<T>::reset(T* ptr)
{
	if (this->m_ptr != ptr)
	{
		delete this->m_ptr;
		this->m_ptr = ptr;
	}
}

}

#endif